﻿<Window x:Class="System.DbSizeForecaster.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="544" Width="741" Title="MS-Sql Database Size Estimator" Icon="/DataSizer;component/App.Ico">
    <Window.Resources>
        <Style x:Key="CellEditStyle" TargetType="{x:Type TextBox}">
            <Setter Property="Background" Value="Yellow"></Setter>
        </Style>
        <Style x:Key="NumericCell" TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Right"/>
        </Style>
        <Style x:Key="NumericTextBox" TargetType="{x:Type TextBox}">
            <Setter Property="TextAlignment" Value="Right"></Setter>
        </Style>
        <Style x:Key="HeaderText" TargetType="{x:Type Label}">
            <Setter Property="FontSize" Value="18"></Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <DataGrid Height="318" Margin="12,150,0,0" Width="601" AutoGenerateColumns="False" HorizontalAlignment="Left" Name="dataGridTables" VerticalAlignment="Top" SelectionChanged="dataGridTables_SelectionChanged">
            <DataGrid.Columns>
                <DataGridTextColumn Width="200" Binding="{Binding TableName}" Header="Table Name" IsReadOnly="True" ElementStyle="{StaticResource NumericCell}">
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding ExistingEntitiesCount,StringFormat=n0}" Header="Existing Entities" IsReadOnly="True" ElementStyle="{StaticResource NumericCell}">
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding ForecastedEntitiesCount,StringFormat=n0}" Header="Forecasted New Entities" ElementStyle="{StaticResource NumericCell}" EditingElementStyle="{StaticResource CellEditStyle}">
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Path=TotalTableSize,StringFormat=n2}" Header="Forecasted Table Size (KB)" IsReadOnly="True" ElementStyle="{StaticResource NumericCell}">
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        <Button Height="23" Margin="525,103,0,0" Width="184" Click="buttonSqlDatabase_Click" Content="Select Database" HorizontalAlignment="Left" Name="buttonSqlDatabase" VerticalAlignment="Top">
            <Button.ToolTip>
                <TextBlock Text="Select SQL Server Database"></TextBlock>
            </Button.ToolTip>
        </Button>
        <TextBox Height="23" Margin="160,103,0,0" Width="361" HorizontalAlignment="Left" Name="textBoxConnectionString" IsReadOnly="True" VerticalAlignment="Top">
        </TextBox>
        <Button Height="23" Margin="619,148,0,0" Width="90" Click="buttonRemove_Click" Content="Remove" HorizontalAlignment="Left" Name="buttonRemove" VerticalAlignment="Top" ToolTip="Remove the table from the project." />
        <Button Height="76" Margin="619,177,0,0" Width="90" Click="buttonUpdate_Click" Content="Update" HorizontalAlignment="Left" Name="buttonUpdate" VerticalAlignment="Top" ToolTip="Calculate Database Size" />
        <Label Height="37" Margin="12,12,0,0" Width="438" Content="MS-Sql Database Size Forecaster" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" Style="{StaticResource HeaderText}" />
        <Button Height="23" Margin="525,41,0,0" Width="88" Click="buttonOpenProject_Click" Content="Open Project" HorizontalAlignment="Left" Name="buttonOpenProject" VerticalAlignment="Top" />
        <Button Height="23" Margin="619,41,0,0" Width="90" Click="buttonSaveProject_Click" Content="Save Project" HorizontalAlignment="Left" Name="buttonSaveProject" VerticalAlignment="Top" />
        <Label Height="28" Margin="12,124,0,0" Content="Database Tables" HorizontalAlignment="Left" Name="label2" VerticalAlignment="Top" Width="133" />
        <Label Height="28" Margin="12,474,0,0" Width="340" Content="Total Forecasted Database Size (excluding transaction log)" HorizontalAlignment="Left" Name="label3" VerticalAlignment="Top" />
        <TextBox Height="23" Margin="447,474,106,0" Width="168" Name="textBoxTotalSize" VerticalAlignment="Top" ToolTip="MB" IsReadOnly="True" Style="{StaticResource NumericTextBox}" />
        <Label Content="Percentage reserve for indexes and unused data" Height="28" HorizontalAlignment="Right" Margin="0,69,198,0" Name="label4" VerticalAlignment="Top" Width="273" />
        <TextBox Height="23" HorizontalAlignment="Right" Text="30" Style="{StaticResource NumericTextBox}" Margin="0,74,106,0" Name="textBoxIndexReserve" VerticalAlignment="Top" Width="88" TextChanged="textBoxIndexReserve_TextChanged" LostFocus="textBoxIndexReserve_LostFocus" />
        <Label Content="%" Height="28" HorizontalAlignment="Left" Margin="616,72,0,0" Name="label5" VerticalAlignment="Top" />
        <Label Content="MB" Height="28" HorizontalAlignment="Right" Margin="0,471,75,0" Name="label6" VerticalAlignment="Top" />
        <CheckBox Content="Forecast using existing data/statistics?" Height="23" HorizontalAlignment="Left" Margin="12,74,0,0" Name="checkBox1" VerticalAlignment="Top" IsChecked="True" />
        <Label Content="Connection String" Height="28" HorizontalAlignment="Left" Margin="12,98,0,0" Name="label7" VerticalAlignment="Top" />
    </Grid>
</Window>